while ( cur && *cur ) {
switch (*cur) {
case 'n': case 's': case 'N': case 'S':
- if ( numind && numind < 3 ) {
- numind = 0;
+ if ( unk[0] != 999 ) {
+ numind = 0;
+ numres = unk;
+ lat[0] = unk[0];
+ lat[1] = unk[1];
+ lat[2] = unk[2];
+ unk[0] = unk[1] = unk[2] = 999;
+ }
+ else {
+ numres = lat;
+ numind = 0;
+ lat[0] = lat[1] = lat[2] = 999;
}
- lat[0] = unk[0];
- lat[1] = unk[1];
- lat[2] = unk[2];
-
- numres = lat;
if ( *cur == 'n' || *cur == 'N' )
latsign = 1;
cur++;
break;
case 'w': case 'e': case 'W': case 'E':
- if ( numind && numind < 3 ) {
- numind = 0;
+ if ( unk[0] != 999 ) {
+ numind = 0;
+ numres = unk;
+ lon[0] = unk[0];
+ lon[1] = unk[1];
+ lon[2] = unk[2];
+ unk[0] = unk[1] = unk[2] = 999;
+ }
+ else {
+ numres = lon;
+ numind = 0;
+ lon[0] = lon[1] = lon[2] = 999;
}
- lon[0] = unk[0];
- lon[1] = unk[1];
- lon[2] = unk[2];
-
- numres = lon;
if ( *cur == 'e' || *cur == 'E' )
lonsign = 1;
sprintf( buff+strlen(buff), subformat );
}
formatptr += strlen(subformat);
- } // end while;
+ }
xfree(subformat);
}
--- /dev/null
+W 5 10 15 20 25 30 N
+1°23'45.678"S 1°23'45.678"E
+12d 34.567m N 76d 54.321m E
+N 12.345 W 67.890
+12.345N 67.890W
+12.345N W67.890
+
--- /dev/null
+20.42500 -5.17083
+-1.39602 01.39602
+12.57612 76.90535
+12.34500 -67.89000
+12.34500 -67.89000
+12.34500 -67.89000
--- /dev/null
+# gpsbabel XCSV style file
+#
+# Format: Human readable read test style
+# Author: Ron Parker
+# Date: 21 July 2004
+#
+
+DESCRIPTION Human readable read test style
+EXTENSION txt
+
+#
+# FILE LAYOUT DEFINITIIONS:
+#
+FIELD_DELIMITER TAB
+RECORD_DELIMITER NEWLINE
+
+#
+# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:
+#
+IFIELD LATLON_HUMAN_READABLE, "", ""
--- /dev/null
+N 20.425000 W 5.170833 N 020° 25.500' W 005° 10.250' 20.425000 N 5.170833 W N 20.425000 W 5.170833 N 20 25 30.000000 W 5 10 15.000000 N 20 25 30 W 5 10 15 N 20 W 5 20 degrees 5 degrees
+S 1.396022 E 1.396022 S 001° 23.761' E 001° 23.761' 1.396022 S 1.396022 E S 1.396022 E 1.396022 S 1 23 45.678000 E 1 23 45.678000 S 1 23 45 E 1 23 45 S 1 E 1 1 degrees 1 degrees
+N 12.576117 E 76.905350 N 012° 34.567' E 076° 54.321' 12.576117 N 76.905350 E N 12.576117 E 76.905350 N 12 34 34.020000 E 76 54 19.260000 N 12 34 34 E 76 54 19 N 12 E 76 12 degrees 76 degrees
+N 12.345000 W 67.890000 N 012° 20.700' W 067° 53.400' 12.345000 N 67.890000 W N 12.345000 W 67.890000 N 12 20 42.000000 W 67 53 24.000000 N 12 20 42 W 67 53 24 N 12 W 67 12 degrees 67 degrees
+N 12.345000 W 67.890000 N 012° 20.700' W 067° 53.400' 12.345000 N 67.890000 W N 12.345000 W 67.890000 N 12 20 42.000000 W 67 53 24.000000 N 12 20 42 W 67 53 24 N 12 W 67 12 degrees 67 degrees
+N 12.345000 W 67.890000 N 012° 20.700' W 067° 53.400' 12.345000 N 67.890000 W N 12.345000 W 67.890000 N 12 20 42.000000 W 67 53 24.000000 N 12 20 42 W 67 53 24 N 12 W 67 12 degrees 67 degrees
--- /dev/null
+# gpsbabel XCSV style file
+#
+# Format: Human readable write test style
+# Author: Ron Parker
+# Date: 21 July 2004
+#
+
+DESCRIPTION Human readable write test style
+EXTENSION txt
+
+#
+# FILE LAYOUT DEFINITIIONS:
+#
+FIELD_DELIMITER TAB
+RECORD_DELIMITER NEWLINE
+
+#
+# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:
+#
+IFIELD LATLON_HUMAN_READABLE, "", "%c %f"
+IFIELD LATLON_HUMAN_READABLE, "", "%c %.3d° %6.3f'"
+IFIELD LATLON_HUMAN_READABLE, "", "%f %c"
+IFIELD LATLON_HUMAN_READABLE, "", "%c %f"
+IFIELD LATLON_HUMAN_READABLE, "", "%c %d %d %f"
+IFIELD LATLON_HUMAN_READABLE, "", "%c %d %d %d"
+IFIELD LATLON_HUMAN_READABLE, "", "%c %d"
+IFIELD LATLON_HUMAN_READABLE, "", "%d degrees"
+
PNAME=${PNAME:-./gpsbabel}
DIFF=${DIFF:-diff}
+OD=${OD:-od -Ax -txC -v}
TMPDIR=/tmp/gpsbabel.$$
mkdir -p $TMPDIR
trap "rm -fr $TMPDIR" 0 1 2 3 15
+bincompare()
+{
+ rm -f ${TMPDIR}/bc1
+ rm -f ${TMPDIR}/bc2
+ ${OD} $1 >${TMPDIR}/bc1
+ ${OD} $2 >${TMPDIR}/bc2
+ ${DIFF} ${TMPDIR}/bc1 ${TMPDIR}/bc2 || {
+ echo ERROR binary comparing $*
+ exit 1
+ }
+}
+
compare()
{
${DIFF} $* || {
compare ${TMPDIR}/magnavt.gpu ${TMPDIR}/magnav.gpu
compare reference/gu.wpt ${TMPDIR}/magnav.gpu
+rm -f ${TMPDIR}/magnav.pdb
+${PNAME} -i geo -f geocaching.loc -o magnav -F ${TMPDIR}/magnav.pdb
+bincompare ${TMPDIR}/magnav.pdb reference/magnav.pdb
+
+
+
# GPSPilot Tracker for PalmOS
# This test is eerily similar to the NAV Companion test. In fact, the
# converted reference file (magnavr.gpu) is identical.
#
rm -f ${TMPDIR}/netstumbler.mps
${PNAME} -i netstumbler -f reference/netstumbler.txt -o mapsource -F ${TMPDIR}/netstumbler.mps
-compare ${TMPDIR}/netstumbler.mps reference/netstumbler.mps
+bincompare ${TMPDIR}/netstumbler.mps reference/netstumbler.mps
+
+#
+# XCSV "human readable" tests
+#
+rm -f ${TMPDIR}/humanread.out
+${PNAME} -i xcsv,style=reference/humanread.style -f reference/human.in -o arc -F ${TMPDIR}/humanread.out
+compare ${TMPDIR}/humanread.out reference/humanread.out
+
+rm -f ${TMPDIR}/humanwrite.out
+${PNAME} -i xcsv,style=reference/humanread.style -f reference/human.in -o xcsv,style=reference/humanwrite.style -F ${TMPDIR}/humanwrite.out
+compare ${TMPDIR}/humanwrite.out reference/humanwrite.out
exit 0